using System;
using System.ComponentModel.DataAnnotations;

namespace AltNetHispano.Vale.DataAnnotations.Tests.SampleEntities
{
	public class Person
	{
		[Required(ErrorMessage = "Name is required.")]
		public string Name { get; set; }
		
		[Required(ErrorMessage = "Surname is required.")]
		public string Surname { get; set; }

		[ShouldBeInThePast(ErrorMessage = "Birthday should be in the past.")]
		public DateTime Birthday { get; set; }
	}


	public class ShouldBeInThePastAttribute : ValidationAttribute
	{
		public override bool IsValid(object value)
		{
			var date = (DateTime) value;
			return date < DateTime.Today;
		}
	}
}